FROM zhyusdocker/tomcat8:8.5.47

ADD server.xml /opt/tomcat/conf/
ADD log4j.properties /opt/tomcat/lib/
ADD tomcat-juli-adapters.jar /opt/tomcat/lib/
COPY context.xml /opt/tomcat/conf/

RUN rm -rf /opt/tomcat/webapps/manager  && \
 rm ${CATALINA_HOME}/conf/logging.properties  && \
 rm ${CATALINA_HOME}/bin/tomcat-juli.jar  && \
 rm ${CATALINA_HOME}/conf/context.xml

ADD tomcat-juli.jar /opt/tomcat/bin/
ADD server-2.0.war /opt/tomcat/webapps/ROOT.war

RUN cd /opt/tomcat/webapps/

RUN unzip -d /opt/tomcat/webapps/ROOT /opt/tomcat/webapps/ROOT.war && \
	rm -rf /opt/tomcat/webapps/ROOT.war
	
VOLUME /opt/tomcat/logs
VOLUME /opt/tomcat/webapps/ROOT/upload

EXPOSE 8080
EXPOSE 8080

WORKDIR /opt/tomcat

ENTRYPOINT ["/opt/tomcat/bin/catalina.sh"]
CMD [ "run" ]
